#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Purpose: Test IRAS plugin def
# Created: 02/17/2010
# $Id $
# Copyright (c) 2008,2009 by University College London
# Authors:
#  --<>
#
# This program is free software under the GPL (>=v2)
# Read the file COPYING coming with HydroPlatform for details.


import support
import unittest

from hydroplatform.model.network import Node, Project, NodeType, Network, \
     NodeField, FieldGroup, LinkType, LinkField

from hydroplatform.model.nodetypes import register_definition


class IrasTest(unittest.TestCase):
    
    def test_definition(self):
        support.init_hydroplatform()
        self.session = support.get_dbsession()
        (self.nodetypes, self.nodes, self.links, self.network) = \
            support.load_sample_network1(self.session) 
        project =self.session.query(Project).first()
        
        from hydroplatform.extension.iras import definition
        
        keys, values = definition.get_node_types(project)
        self.assertEqual(len(values), 9)
        
        register_definition(self.session, project, definition)
        

if __name__=='__main__':
    unittest.main()